package com.xinfu.newproject.adapter.park_adapter;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.xinfu.newproject.R;
import com.xinfu.newproject.bean.park_bean.bean.FeeListBean;

public class MonthCardPayListAdapter extends BaseQuickAdapter<FeeListBean.ResultBean, BaseViewHolder> {
    public MonthCardPayListAdapter() {
        super(R.layout.item_monthcard_paylist, null);
    }

    @Override
    protected void convert(BaseViewHolder helper, FeeListBean.ResultBean item) {
        Context context = helper.getConvertView().getContext();
        helper.setText(R.id.tv_order_num, item.getSn());
        helper.setText(R.id.tv_createTime, item.getPayTime());
        helper.setText(R.id.tv_payAmount, item.getPayAmount() + "元");
        //订单状态
        TextView tv_order_status = helper.getView(R.id.tv_order_status);
        ImageView imageView = helper.getView(R.id.img_closestatus);
        int color_ing = context.getResources().getColor(R.color.text_status_ing);
        int color_over = context.getResources().getColor(R.color.text_status_over);
        int color_error = context.getResources().getColor(R.color.text_status_error);
        int color_finish = context.getResources().getColor(R.color.text_status_finish);
        int payStatus = item.getPayStatus();
        imageView.setVisibility(View.GONE);
        if (payStatus == 0) {
            tv_order_status.setTextColor(color_ing);
            tv_order_status.setText("订单审核中");
        } else if (payStatus == 1) {
            tv_order_status.setTextColor(color_ing);
            tv_order_status.setText("订单审核通过待支付");
        }
        if (payStatus == 2) {
            tv_order_status.setTextColor(color_ing);
            tv_order_status.setText("支付中");
        }
        if (payStatus == 3) {
            tv_order_status.setTextColor(color_ing);
            tv_order_status.setText("凭证提交中");
        }
        if (payStatus == 4) {
            tv_order_status.setTextColor(color_ing);
            tv_order_status.setText("凭证确认中");
        }
        if (payStatus == 5) {
            tv_order_status.setTextColor(color_finish);
            tv_order_status.setText("支付成功");
        }
        if (payStatus == 90) {
            tv_order_status.setTextColor(color_error);
            tv_order_status.setText("订单审核失败");
        }
        if (payStatus == 93) {
            tv_order_status.setTextColor(color_error);
            tv_order_status.setText("订单凭证确认失败");
        }
        if (payStatus == 94) {
            tv_order_status.setTextColor(color_over);
            tv_order_status.setText("订单失效");
            imageView.setImageResource(R.mipmap.img_checkstatus_beoff);
            imageView.setVisibility(View.VISIBLE);
        }
        if (payStatus == 99) {
            tv_order_status.setTextColor(color_error);
            tv_order_status.setText("支付失败或用户取消");
        }

    }


}
